package command_impl;

import java.util.*;

import app.OrderDao;
import command.Command;
import pojo.Product;

public class ListCommand implements Command {

	@Override
	public void execute() {
		OrderDao dao = new OrderDao();
		
		System.out.println("\n已上架的商品:");
		List<Product> products = dao.getAllProducts();
		System.out.println("---------------------------------------------");
		for(Product product:products){
			System.out.print("商品ID:"+product.getId());
			System.out.print("  商品名:"+product.getName());
			System.out.println("  商品分类:"+product.getCatalog());
			System.out.println("单价:"+product.getPrice()+"元/"+product.getProduct_Unit());
			System.out.println("---------------------------------------------");
		}
	}

}
